import { Request, Response } from 'express';

function getProblemDetail(req: Request, res: Response, u: string) {
  const result = {
    code: 0,
    body: {
      id: 123456, // #订单id
      orderId: 123456, // #订单id
      expCode: '121212',
      expressName: '顺丰快递',
      consigneePhone: '13312345678', // #收件人
      inTime: '2020-01-01 10:00:00', // #入库时间
      outTime: '2020-01-01 10:00:00', // #出库时间
      problemStatus: 1,
      problemType: 1,
      updateTime: '2020-01-01 10:00:00',
      updateUser: '张三',
      createTime: '2020-01-01 10:00:00', // #创建时间
      createUser: '张三',
      remark: '123',
    },
  };

  return res.json(result);
}

const dataSource: any[] = [];

for (let i = 0; i < 5; i += 1) {
  dataSource.push({
    id: 123456 + i,
    createTime: '2020-1-1 12:12:12',
    createUser: '小新',
    result: '121212',
  });
}

function getRecordList(req: Request, res: Response, u: string) {
  const result = {
    code: 0,
    message: 'success',
    body: dataSource,
  };

  return res.json(result);
}

export default {
  'GET  /problem/detail': getProblemDetail,
  'GET  /problem/record': getRecordList,
};
